package com.fusion.task.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fusion.task.service.JobTaskService;

@RestController
public class TaskController {

	@Autowired
	private JobTaskService taskService;

	//启动任务
	@GetMapping("startTask")
	public String startTask(String name,String group,String cron){
		Map<String, Object> hashMap = new HashMap<String,Object>();
		hashMap.put("id", "id1234");
		taskService.startTask(name, group, cron,hashMap);
		return null;
	}
	
	//修改任务的执行时间
	@GetMapping("updateTaskCron")
	public String updateTaskCron(String name,String group,String cron){
		taskService.updateTaskCron(name, group, cron,null);  
		return null;
	}
	
	//暂定任务
	@GetMapping("suspendedTask")
	public String suspendedTask(String name, String group) {
		taskService.suspendedTask(name, group);
		return null;
	}
	
	//恢复任务
	@GetMapping("restoreTask")
	public String restoreTask(String name, String group) {
		taskService.restoreTask(name, group);
		return null;
	}
	
	//删除任务
	@GetMapping("deletTask")
	public String deletTask(String name, String group) {
		taskService.deletTask(name, group);
		return null;
	}
}
